package com.codeworker.validationdemo.bean;

import lombok.Builder;
import lombok.Data;

import javax.validation.constraints.*;
import java.io.Serializable;

/**
 * Description: 学生信息类
 *
 * @author code-worker
 * @date 2021/09/25 10:04
 */
@Data
public class Student implements Serializable {
    @NotEmpty(message = "学生姓名不能为空")
    private String name;
    @NotNull(message = "学生性别不能为空")
    @Pattern(regexp = "[男女]", message = "输入的性别不对")
    private String sex;
    @NotNull(message = "学生年龄不能为空")
    @DecimalMin(value = "1", message = "年龄必须不小于1")
    @DecimalMax(value = "120", message = "年龄必须不大于100")
    private Integer age;
    @Email(message = "邮箱格式不正确")
    private String email;
}
